package com.liao.work;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.liao.work.ui.activity.bmi.BMITestActivity;
import com.liao.work.ui.activity.BookActivity;
import com.liao.work.ui.activity.CalculationActivity;
import com.liao.work.ui.activity.CarouselActivity;
import com.liao.work.ui.activity.game.GameMoraActivity;
import com.liao.work.ui.activity.InfoListActivity;
import com.liao.work.ui.activity.PhotosActivity;
import com.liao.work.ui.activity.register.RegisterActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button button;
    private Button button2;
    private Button button3;
    private Button button4;
    private Button button5;
    private Button button6;
    private Button button7;
    private Button button8;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

    }

    private void initView() {
        button = (Button) findViewById(R.id.button);
        button2 = (Button) findViewById(R.id.button2);
        button3 = (Button) findViewById(R.id.button3);
        button4 = (Button) findViewById(R.id.button4);
        button5 = (Button) findViewById(R.id.button5);
        button6 = (Button) findViewById(R.id.button6);
        button7 = (Button) findViewById(R.id.button7);
        button8 = (Button) findViewById(R.id.button8);

        button.setOnClickListener(this);
        button2.setOnClickListener(this);
        button3.setOnClickListener(this);
        button4.setOnClickListener(this);
        button5.setOnClickListener(this);
        button6.setOnClickListener(this);
        button7.setOnClickListener(this);
        button8.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()) {
            case R.id.button:
                intent = new Intent(this, RegisterActivity.class);
                break;
            case R.id.button2:
                intent = new Intent(this, CalculationActivity.class);
                break;
            case R.id.button3:
                intent = new Intent(this, GameMoraActivity.class);
                break;
            case R.id.button4:
                intent = new Intent(this, BMITestActivity.class);
                break;
            case R.id.button5:
                intent = new Intent(this, BookActivity.class);
                break;
            case R.id.button6:
                intent = new Intent(this, InfoListActivity.class);
                break;
            case R.id.button7:
                intent = new Intent(this, PhotosActivity.class);
                break;
            case R.id.button8:
                intent = new Intent(this, CarouselActivity.class);
                break;
        }
        if (intent != null) {
            startActivity(intent);
        }
    }
}
